<template>
	<view>
		<view class="head">
			<image src="../../static/img/detail01.png" mode="" class="head-bg"></image>
			<view class="user-info flex flai">
				<image :src="userInfo.avatarUrl" mode=""></image>
				<text>{{userInfo.nickName}}</text>
			</view>
		</view>
		<view class="my-box">
			<view class="my-head flex flai fljcsb">
				<text>我的订单</text>
				<navigator url="/pages/myOrder/myOrder?state=0">查看全部订单
					<image src="../../static/img/arrow-right.png" mode=""></image>
				</navigator>
			</view>
			<view class="order-class flex flai fljcsb">
				<navigator url="/pages/myOrder/myOrder?state=1" class="order-class-list flex flai">
					<image src="../../static/img/my/dfk.png" mode=""></image>
					<text>待付款</text>
					<text class="tag" v-if="info.waitPay>0">{{info.waitPay}}</text>
				</navigator>
				<navigator url="/pages/myOrder/myOrder?state=2" class="order-class-list flex flai">
					<image src="../../static/img/my/dfh.png" mode=""></image>
					<text>待发货</text>
					<text class="tag" v-if="info.waitShipment>0">{{info.waitShipment}}</text>
				</navigator>
				<navigator url="/pages/myOrder/myOrder?state=3" class="order-class-list flex flai">
					<image src="../../static/img/my/dsh.png" mode=""></image>
					<text>待收货</text>
					<text class="tag" v-if="info.waitDelivery>0">{{info.waitDelivery}}</text>
				</navigator>
				<navigator url="/pages/myOrder/myOrder?state=4" class="order-class-list flex flai">
					<image src="../../static/img/my/fished.png" mode=""></image>
					<text>已完成</text>
					<text class="tag" v-if="info.complete>0">{{info.complete}}</text>
				</navigator>
			</view>
		</view>
		<view style="height: 100rpx;">
			
		</view>
		<view class="other-module">
			<view class="module-list">
				<navigator url="/pages/writeOrder/writeOrder" open-type="switchTab" class="flex flai fljcsb">
					<view class="module-list-left flex flai">
						<image src="../../static/img/my/myAdd.png" mode=""></image>
						<text>添加代发单</text>
					</view>
					<image src="../../static/img/arrow-right.png" mode="" class="arrow-right"></image>
				</navigator>
				<navigator url="/pages/myBuy_store/myBuy_store" class="flex flai fljcsb" v-if="isMecahrt">
					<view class="module-list-left flex flai">
						<image src="../../static/img/my/myBuy.png" mode=""></image>
						<text>我的求购</text><!---商家-->
					</view>
					<image src="../../static/img/arrow-right.png" mode="" class="arrow-right"></image>
				</navigator>
				<navigator url="/pages/myBuy_user/myBuy_user" class="flex flai fljcsb" v-else>
					<view class="module-list-left flex flai">
						<image src="../../static/img/my/myBuy.png" mode=""></image>
						<text>我的求购</text><!--个人-->
					</view>
					<image src="../../static/img/arrow-right.png" mode="" class="arrow-right"></image>
				</navigator>
				<navigator url="/pages/upMarkPrice/upMarkPrice" class="flex flai fljcsb">
					<view class="module-list-left flex flai">
						<image src="../../static/img/my/upprice.png" mode=""></image>
						<text>上传报价</text>
					</view>
					<image src="../../static/img/arrow-right.png" mode="" class="arrow-right"></image>
				</navigator>
			</view>
			<view class="module-list" v-if="!isMecahrt">
				<navigator url="/pages/bindMechart/bindMechart" class="flex flai fljcsb">
					<view class="module-list-left flex flai">
						<image src="../../static/img/my/bind.png" mode=""></image>
						<text>绑定商家</text>
					</view>
					<image src="../../static/img/arrow-right.png" mode="" class="arrow-right"></image>
				</navigator>
				<navigator url="/pages/shopsAuthentication/shopsAuthentication" class="flex flai fljcsb">
					<view class="module-list-left flex flai">
						<image src="../../static/img/my/mearcht.png" mode=""></image>
						<text>商家认证</text>
					</view>
					<image src="../../static/img/arrow-right.png" mode="" class="arrow-right"></image>
				</navigator>
			</view>
			<view class="prompt-msg">
				如有需要，请联系微信公众号客服，谢谢。
			</view>
		</view>
	
			<adv/>
		<view style="height: 40rpx;">
			
		</view>
	</view>
</template>

<script>
	import adv from '../components/adv/adv.vue'
	import API from '../../api/index.js'
	export default {
		components:{
			adv
		},
		data() {
			return {
				isMechart:uni.getStorageSync('userinfo').isMerchant,// 是不是商家
				info:{
					waitDelivery: "0",//待收货
					waitPay: "0",//待付款数量
					complete: "0",//complete
					waitShipment: "0",//待发货
				},
				userInfo:uni.getStorageSync('userinfo').userInfo,
				isMecahrt: uni.getStorageSync('userinfo').isMerchant
			};
		},
		onLoad() {

			
		},
		onShow () {
			if (uni.getStorageSync('userinfo').userInfo.nickName=='') {
				uni.navigateTo({
					url:'/pages/login/login'
				})
			} else {
				this.userInfo=uni.getStorageSync('userinfo').userInfo
			}
			this.geOrderInfo()
		},
		methods: {
			geOrderInfo() {
				API.indexHome.getOrderNum().then(res=>{
					if (res.errno==0) {
						this.info = res.data
					}
				})
			}
		},
	};
</script>

<style>
	@import url("./index.css");
</style>
